package com.example.controllor;



import com.example.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/persons")
public class PersonController {

    private final PersonService personService;

    @Autowired
    public PersonController(PersonService personService) {
        this.personService = personService;
    }

    @PostMapping("/{personId}/addToTeam/{teamId}")
    public String addPersonToTeam(@PathVariable Long personId, @PathVariable Long teamId) {
        personService.addPersonToTeam(personId, teamId);
        return "Person added to team successfully";
    }
}
